import QtQuick 2.0
import QtQuick.Controls 1.1
import org.qtproject.qtquick 1.0
import "qrc:/js/resources/Constants.js" as Constant

import "../delegate"
import "../common"
import "../page"
import "../setup"
import "../configure"


MainFooterPage {
    id: id_chatPage

    width: 480 * m_ratio
    height: 640 * m_ratio

    property var m_userId ;
    property var m_friendId ;

    property real m_ratio : ApplicationInfo.ratio;
    property int m_margin: 10 * m_ratio;

    property string fullName: ApplicationInfo.fullName
    property string avatarUser: ApplicationInfo.avatarUser

    color: "#ffffff"

    m_footer.title: "Search friends ..."
    m_footer.imageIcon: "qrc:/images/resources/icon_search_xam.png"
    m_footer.onBackClicked: {
        console.log("m_footer.onSearched click ");
    }

    Item {
        id: id_chatPageItem

        width: parent.width
        height: parent.height - m_footer.height

        anchors.bottom: m_footer.top;

        anchors.topMargin: 5;

        SetupHeader {
            id: header
        }
        Item {
            id: id_itemList
            width: parent.width
            height: parent.height

            y: header.y + header.height - 80 * m_ratio

            ListView {
                id: id_setupList
                width: parent.width
                height: parent.height

                model: SetupModel { }

                delegate: SetupDelegate { }

                spacing: 0 * m_ratio

                onContentYChanged: {
                    if (-id_setupList.contentY > 80 * m_ratio) {
                        header.y = id_itemList.y - header.height - id_setupList.contentY
                    } else {
                        header.y = -id_setupList.contentY
                    }
                }
            }

        }
    }

    Component.onCompleted:{
        //ApplicationInfo.positionViewAtIndexMessage.connect(positionViewAtIndexMessage);
    }
}
